/**
 * 路由文件
 * @author: xiaoming
 * @date: 16/8/9
 */

(function (){
    'use strict';

    angular.module('app')
        .config(routeConfig);

    routeConfig.$inject = ['$stateProvider', '$urlRouterProvider'];
    function routeConfig($stateProvider, $urlRouterProvider){
        $stateProvider
            .state('login', {
                title: '登录',
                url: '/login',
                templateUrl : '/public/views/login/login.html',
                resolve: {
                    dependencies: [
                        '$ocLazyLoad', function ($ocLazyLoad) {
                            return $ocLazyLoad.load({
                                files: [
                                    '/public/views/login/login.controller.js'
                                ]
                            });
                        }
                    ]
                }
            });

        $stateProvider
            .state("main", {
                abstract: true,
                templateUrl: '/public/views/main.html'
            })
            .state("main.order", {
                title: "订单管理",
                url : '/order',
                templateUrl : '/public/views/order/orderList.html',
                resolve: {
                    dependencies: [
                        '$ocLazyLoad', function ($ocLazyLoad) {
                            return $ocLazyLoad.load({
                                files: [
                                    '/public/views/order/orderList.controller.js'
                                ]
                            });
                        }
                    ]
                }
            })
            .state("main.passerge", {
                title: '乘客信息',
                url: '/passerge',
                templateUrl : '/public/views/person/passerge.html',
                resolve: {
                    dependencies: [
                        '$ocLazyLoad', function ($ocLazyLoad) {
                            return $ocLazyLoad.load({
                                files: [
                                    '/public/views/person/passerge.controller.js'
                                ]
                            });
                        }
                    ]
                }
            });

        $urlRouterProvider.otherwise('/login');
    }
})();
